package com.yf.ability.upload.providers.qiniu.controller;


import com.yf.base.api.api.ApiRest;
import com.yf.base.api.api.controller.BaseController;
import com.yf.ability.upload.providers.qiniu.dto.QiniuTokenDTO;
import com.yf.ability.upload.providers.qiniu.service.QiniuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 本地文件上传下载请求类
 * @author bool
 */
@Log4j2
@Api(tags = {"文件上传"})
@RestController
public class QiniuController extends BaseController {

    @Autowired
    private QiniuService qiniuService;

    /**
     * 获得上传Token
     * @return
     */
    @PostMapping("/api/common/qiniu/token")
    @ApiOperation(value = "获得七牛Token")
    public ApiRest<QiniuTokenDTO> token() {
        QiniuTokenDTO respDTO = qiniuService.token();
        return super.success(respDTO);
    }
}
